package com.jixiaotian.spring.annotation.demo.annotation.lifecycle;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Arrays;
import java.util.Random;

/**
 * @Author: jixiaotian.ch@qq.com
 * @Date : 2020/9/10
 */
public class MyTest {

    @Test
    public void test() {
        AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(MyConfig.class);
        System.out.println("IoC容器初始化创建完成");
        System.out.println(Arrays.toString(app.getBeanDefinitionNames())
                .replaceAll("\\[|\\]", "")
                .replaceAll(" ","")
                .replaceAll(",", "\n"));
        System.out.println(app.getBean("car"));

        app.close();


        ApplicationContext applicationContext = new AnnotationConfigApplicationContext();

        applicationContext.getBean("");

    }

}
